namespace System
{
    /// <summary>
    /// Asynchronious operation.
    /// </summary>
    /// <typeparam name="TArgs"></typeparam>
    /// <typeparam name="TResult"></typeparam>
    public interface IAsyncOperation<TArgs, TResult>
    {
        /// <summary>
        /// When implemented, begins async execution.
        /// </summary>
        /// <param name="args">Arguments.</param>
        /// <param name="callback"><see cref="AsyncCallback">Callback</see>.</param>
        /// <param name="state">State.</param>
        /// <returns><see cref="IAsyncResult">IAsyncResult</see> implementation.</returns>
        IAsyncResult Begin(TArgs args, AsyncCallback callback, object state);

        /// <summary>
        /// When implemented, completes async execution.
        /// </summary>
        /// <param name="asyncResult"><see cref="IAsyncResult">IAsyncResult</see> implementation.</param>
        /// <returns>Result of async execution.</returns>
        TResult End(IAsyncResult asyncResult);
    }
}